﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace HR.ProjectX.Models.Entities.Customers
{
    public class Customer : EntityBase<int>, IAggregateRoot
    {
        public virtual string CustomerName { get; set; }
        public virtual string CustomerGender { get; set; }
        public virtual string CustomerEmail { get; set; }
        public virtual string CustomerPhoneNumer { get; set; }
        public virtual string CustomerAddress { get; set; }
        public virtual string CustomerTown { get; set; }
        public virtual string CustomerCountry { get; set; }

        protected override void Validate()
        {
            if (string.IsNullOrEmpty(CustomerName))
            {
                base.AddBrokenRule(CustomerBusinessRules.CustomerNameRequired);
            }

            if (string.IsNullOrEmpty(CustomerGender))
            {
                base.AddBrokenRule(CustomerBusinessRules.CustomerGenderRequired);
            }

            if (string.IsNullOrEmpty(CustomerEmail))
            {
                base.AddBrokenRule(CustomerBusinessRules.CustomerEmailRequired);
            }

            if (string.IsNullOrEmpty(CustomerPhoneNumer))
            {
                base.AddBrokenRule(CustomerBusinessRules.CustomerPhoneNumerRequired);
            }

            if (string.IsNullOrEmpty(CustomerAddress))
            {
                base.AddBrokenRule(CustomerBusinessRules.CustomerAddressRequired);
            }

            if (string.IsNullOrEmpty(CustomerTown))
            {
                base.AddBrokenRule(CustomerBusinessRules.CustomerTownRequired);
            }

            if (string.IsNullOrEmpty(CustomerCountry))
            {
                base.AddBrokenRule(CustomerBusinessRules.CustomerCountryRequired);
            }
        }
    }
}
